package com.citcc.business.service;

import com.citcc.business.bean.CdzWarn;
import com.citcc.business.bean.WarnExport;
import com.citcc.business.bean.vo.StatisticsWarnVo;
import com.citcc.business.mapper.CdzWarnMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CdzWarnService {

    private final CdzWarnMapper cdzWarnMapper;

    @Autowired
    public CdzWarnService(CdzWarnMapper cdzWarnMapper){
        this.cdzWarnMapper=cdzWarnMapper;
    }
    
    public int insert(CdzWarn record) {
        return cdzWarnMapper.insertSelective(record);
    }

    /**
     * 查询告警列表
     */
    public List<WarnExport> selectAllList(CdzWarn cdzWarn){
        List<WarnExport> list=cdzWarnMapper.selectAllList(cdzWarn);
        return list;
    }

    /**
     * 根据站号统计告警次数
     * @param beginTime
     * @param endTime
     * @return
     */
    public List<StatisticsWarnVo> getWarnNumList(String beginTime, String endTime){
        return cdzWarnMapper.getNumList(beginTime,endTime);
    }

    /**
     * 根据站号查询明细列表
     * @param cdzWarn
     * @return
     */
    public List<WarnExport> getDetailList(CdzWarn cdzWarn){
        return cdzWarnMapper.getDetail(cdzWarn);
    }
    
    public List<CdzWarn> selectCdzWarn(CdzWarn cdzWarn){
        return cdzWarnMapper.selectCdzWarn(cdzWarn);
    }
    
    public boolean updateByPrimaryKey(CdzWarn cdzWarn){
    	return cdzWarnMapper.updateByPrimaryKeySelective(cdzWarn)>0;
    }


}
